package nl.harmidi.midi;

public class MyMidiEvent {

	private int noteNumber;
	private int channel;
	private int velocity;
	private TYPE type;
	private String keyName;

	public enum TYPE {
		NOTE_ON,
		NOTE_OFF
	}
	
	public MyMidiEvent(int channel, TYPE type, int noteNumber, int velocity) {
		this.channel = channel;
		this.velocity = velocity;
		this.type = type;
		this.noteNumber = noteNumber;
		this.keyName = MidiTranslator.getKeyName(noteNumber);
	}

	public int getNoteNumber() {
		return noteNumber;
	}

	public int getChannel() {
		return channel;
	}

	public int getVelocity() {
		return velocity;
	}

	public TYPE getType() {
		return type;
	}

	public String getKeyName() {
		return keyName;
	}

	@Override
	public String toString() {
		return String.format("MyMidiEvent: " +
							"[channel=%s] " +
							"[type=%s]" +
							"[noteNumber=%s]" +
							"[keyName=%s]" +
							"[velocity=%s]",
							channel,
							type.equals(TYPE.NOTE_ON) ? "NOTE_ON" : "NOTE_OFF",
							noteNumber,
							keyName,
							velocity
							);
							
	}
	
	
	
}
